package project.active;

import java.util.ArrayList;



import project.model.PrProject;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

import approve.action.R;

public class L_list_itiempro extends BaseAdapter implements OnItemClickListener{
	private Context context;
	ArrayList<PrProject> lstpro = new ArrayList<PrProject>();
	String ds, dc;
	
	public L_list_itiempro(Context context1,ArrayList<PrProject> lstem1,String dss, String dcc){
		this.context=context1;
		this.lstpro=lstem1;
		this.ds=dss;
		this.dc=dcc;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		
		return lstpro.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		
		return lstpro.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		final PrProject adpr = lstpro.get(arg0);
		if(arg1==null){
			LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			arg1=inflater.inflate(R.layout.l_list_itempro, null);
		}
		
		TextView tvproname=(TextView)arg1.findViewById(R.id.ad_l_tv_proname);
		TextView tvthoigian=(TextView)arg1.findViewById(R.id.ad_l_tv_prothoigian);
		tvproname.setText(adpr.getIdProject()+" - "+ adpr.getNameProject());
		tvthoigian.setText(ds+": "+adpr.getDateStart()+" "+dc+": "+adpr.getDateComplete());
		return arg1;
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		
	}

	
}
